]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Call ibusManager.setEngine() with actual layout
authorTakao Fujiwara <tfujiwar@redhat.com>
Wed, 29 Oct 2025 12:34:22 +0000 (21:34 +0900)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 14 Jan 2026 18:11:29 +0000 (19:11 +0100)
Currently ibusManager.setEngine() is always called with 'xkb:us::eng'
US layout name but the actual language layout is more useful for IBus.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8490
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3784>
(cherry picked from commit e0ab0a68b6ee495d72898db513b053eba78773d8)

js/misc/ibusManager.js
js/ui/status/keyboard.js

index 7083e8dd166013dee207f0c7356c7033c2476778..eeffd76ddd268f8604a1d63d87dfbb9fc9420a70 100644 (file)
@@ -28,6 +28,8 @@ const IBUS_SYSTEMD_SERVICE = 'org.freedesktop.IBus.session.GNOME.service';
 
 const TYPING_BOOSTER_ENGINE = 'typing-booster';
 
+const FALLBACK_ENGINE_ID = 'xkb:us::eng';
+
 function _checkIBusVersion(requiredMajor, requiredMinor, requiredMicro) {
     if ((IBus.MAJOR_VERSION > requiredMajor) ||
         (IBus.MAJOR_VERSION === requiredMajor && IBus.MINOR_VERSION > requiredMinor) ||
@@ -283,7 +285,16 @@ class IBusManager extends Signals.EventEmitter {
                 this._MAX_INPUT_SOURCE_ACTIVATION_TIME,
                 this._cancellable);
         } catch (e) {
-            logErrorUnlessCancelled(e);
+            if (!logErrorUnlessCancelled(e))
+                return;
+
+            try {
+                await this._ibus.set_global_engine_async(FALLBACK_ENGINE_ID,
+                    this._MAX_INPUT_SOURCE_ACTIVATION_TIME,
+                    this._cancellable);
+            } catch (e2) {
+                logErrorUnlessCancelled(e2);
+            }
         }
     }
 
index c4779d4eba65fa7f13cead7e32c2668628088ece..96f0dff0fcb54d9cb850f7822f09e038dbc73b63 100644 (file)
@@ -510,17 +510,14 @@ export class InputSourceManager extends Signals.EventEmitter {
             KeyboardManager.holdKeyboard();
         this._keyboardManager.apply(is.xkbId);
 
-        // All the "xkb:..." IBus engines simply "echo" back symbols,
-        // despite their naming implying differently, so we always set
-        // one in order for XIM applications to work given that we set
-        // XMODIFIERS=@im=ibus in the first place so that they can
-        // work without restarting when/if the user adds an IBus input
-        // source.
         let engine;
-        if (is.type === INPUT_SOURCE_TYPE_IBUS)
+        if (is.type === INPUT_SOURCE_TYPE_IBUS) {
             engine = is.id;
-        else
-            engine = 'xkb:us::eng';
+        } else {
+            const [name, variant = ''] = is.id.split('+');
+            const [lang = 'eng'] = this._xkbInfo.get_languages_for_layout(is.id);
+            engine = `xkb:${name}:${variant}:${lang}`;
+        }
 
         this._ibusManager.setEngine(engine).then(() => {
             if (holdKeyboard)